package com.example.springbootexam.bean;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import java.sql.Timestamp;

/**
 * Company 源辰信息
 *
 * @author navy
 * @date 2024/8/12
 * Email haijunzhou@hnit.edu.cn
 */
@Data
@TableName("user")
public class User {
    @TableId(value="id", type = IdType.AUTO)
    Integer id;
    @NotBlank(message = "账号不能为空!")
    @Length(min = 2, max = 20, message = "账号的长度必须是2~20个字符")
    String name;
    @NotBlank(message = "密码不能为空!")
    @Length(min = 4, max = 16, message = "密码的长度必须是4~16个字符")
    @Pattern(regexp = "[\\w&@\\*]{4,16}", message = "密码必须由数字字母特殊字符构成")
    String pwd;
    @Pattern(regexp = "1[0-9]{10}", message = "手机号码必须是1开头的11位数字")
    String phone;
    @Email
    @NotBlank
    String email;
    @NotBlank
    String head;
    @TableField("create_time")
    Timestamp createTime;
    String role;
}
